import 'package:flutter/material.dart';
import 'package:xindong/common/xindong_sezhi.dart';
import 'package:xindong/common/xindong_define.dart';
import 'package:xindong/models/xindong_notice_class.dart';

class XinDongNoticeMessageCell extends StatelessWidget {
  final XinDongNoticeClass model;
  final Function() onTap; // 删除
  const XinDongNoticeMessageCell({Key? key, required this.model, required this.onTap}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      behavior: HitTestBehavior.opaque,
      child: Container(
        height: 60,
        color: model.is_read == 0 ? DZColors.cellColor : DZColors.backgroundColor,
        padding: const EdgeInsets.only(left: kPaddingValue, right: kPaddingValue),
        margin: const EdgeInsets.only(bottom: 0.5),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Row(
              children: [
                Text(
                  model.type_text,
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  textAlign: TextAlign.left,
                  style: const TextStyle(color: DZColors.titleColor, fontSize: 15, fontWeight: FontWeight.w500),
                ),
                const SizedBox(width: 5),
                Expanded(
                  child: Text(
                    model.context ?? "",
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    textAlign: TextAlign.right,
                    style: const TextStyle(color: DZColors.contentColor, fontSize: 12),
                  ),
                ),
              ],
            ),
            const SizedBox(height: 5),
            Row(
              children: [
                Expanded(
                  child: Text(
                    model.create_time,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    textAlign: TextAlign.left,
                    style: const TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: DZColors.contentColor),
                  ),
                ),
                const SizedBox(width: 5),
                Text(
                  model.is_read == 0 ? "未读" : "已读",
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  textAlign: TextAlign.right,
                  style: const TextStyle(fontSize: 12, color: DZColors.placeholderColor),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
